#include <bits/stdc++.h>
using namespace std;
constexpr int MAXN = 305;
int n, Ans; char A[MAXN], B[MAXN];
bool check(){
  int res = 0;
  for(int i = 1; i <= n; i++){
    res += B[i] == '('? 1: -1;
    if(res < 0) return 0;
  }
  return !res;
}
void DFS(int id){
  if(id > n){
    for(int i = 1; i <= n; i++) B[i] = A[i];
    if(check()){Ans++; return;}
    for(int i = 1; i <= n; i++){
      for(int j = 1; j <= n; j++) B[j] = A[j];
      for(int j = i; j <= n; j++){
        B[j] = A[j] == '('? ')': '(';
        if(check()){Ans++; return;}
      }
    }
  } else if(A[id] == 'x') A[id] = '(', DFS(id + 1), A[id] = ')', DFS(id + 1), A[id] = 'x';
  else DFS(id + 1);
}
int main(){
  freopen("bracket.in", "r", stdin);
  freopen("bracket.out", "w", stdout);
  cin.tie(nullptr)->sync_with_stdio(false);
  cin >> n;
  for(int i = 1; i <= n; i++) cin >> A[i];
  DFS(1), cout << Ans << '\n';
  return 0;
}
